package cse.om.object;

import cse.om.data.DatabaseManager;
import cse.om.data.Profile;
import cse.om.vswn.Sensitivity;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class SensitivityByProfile {
	
	private final Profile _profile;
	private final Map<Date, List<Sensitivity>> _map;
	
	public SensitivityByProfile(Profile profile) {
		_profile = profile;
		_map = new HashMap<>();
	}
	
	public SensitivityByProfile(Long profileId) {
		_profile = DatabaseManager.getProfileById(profileId);
		_map = new HashMap<>();
	}
	
	public Profile getProfile() {
		return _profile;
	}
	
	public void addSensitivity(Sensitivity sensitivity, Date date) {
		if (!_map.containsKey(date))
			_map.put(date, new ArrayList<Sensitivity>());
		_map.get(date).add(sensitivity);
	}
	
	public void addSensitivity(List<Sensitivity> sensitivityList, Date date) {
		if (!_map.containsKey(date))
			_map.put(date, new ArrayList<Sensitivity>());
		_map.get(date).addAll(sensitivityList);
	}
}
